<script>
$(function(){
	// 删除
    $('img[del]').click(function (){
        var uid = $(this).attr('del');
        var nickname = $(this).attr('nickname');
        if(confirm('删除此客户将会把下属的用户删除，真的要删除'+nickname+'吗？')) {
            $.getJSON('?app=<?php echo APP; ?>&mod=deletecustomer',{uid:uid},function(data){
                if (data.state <= 0)
                {
                    alert(data.message);
                    return false;
                }
				dialogMessage(data.message,'green');
                $('tr[wparam='+uid+']').remove();
            });
        }
    });
	
});
</script>
<div class="t_2">
     <div class="fl">客户列表</div>
     <div class="fr add_form"><a href="?app=customer&mod=addcustomer" id="add_table">+添加客户</a></div>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
       <tr>
            <th class="th0">编号</th>
            <th class="th1">客户名称</th>
            <th class="th0">座机</th>
            <th class="th1">手机</th>
            <th class="th1">邮箱</th>
            <th class="th1">地址</th>
            <th class="th1">注册时间</th>
            <th class="th1">操作</th>
       </tr>
       <?php foreach((array)$this->customers as $customer): ?> 
       <tr wparam="<?php echo $customer['customer_id']; ?>">
            <td><?php echo $customer['customer_id']; ?></td>
            <td><?php echo $customer['customer_name']; ?></td>
            <td><?php echo $customer['tel']; ?></td>
            <td><?php echo $customer['mobile']; ?></td>
            <td><?php echo $customer['email']; ?></td>
            <td><?php echo $customer['address']; ?></td>
            <td><?php echo date('Y-m-d H:i',$customer['created_time']); ?></td>
            <td>
            <?php echo opt('edit','?app=customer&mod=editcustomer&customer_id='.$customer['customer_id'],'title="编辑客户"'); ?>
            <?php echo opt('trash','javascript:;','del="'.$customer['customer_id'].'" nickname="'.$customer['customer_name'].'" title="删除"'); ?>
            <?php echo opt('addcustomer','?app=customer&mod=usermanage&customer_id='.$customer['customer_id'].'&opt=add','title="管理用户"'); ?>
            <?php echo opt('productmanage','?app=customer&mod=recommend&customer_id='.$customer['customer_id'],'title="添加推荐商品"'); ?>
            <?php echo opt('fapiaomanage','?app=customer&mod=fapiao&customer_id='.$customer['customer_id'],'title="发票信息管理"'); ?>
            <?php echo opt('addressmanage','?app=customer&mod=address&customer_id='.$customer['customer_id'],'title="收货地址管理"'); ?>
            </td>
       </tr>
       <?php endforeach; ?>
</table>
<div class="page_num">
     <div class="fl">
        <span></span>
     </div>
     <div class="fr">
        <p class="cpager">
            <?php echo $this->pager; ?>
        </p>
     </div>
</div>

